// 登录用户信息存储数据
import { defineStore } from "pinia";
import { ref } from "vue";

export const usePiniaStore = defineStore('piniaStore', () => {
    // 用户信息
    const userInfo = ref<any>({});
    // 权限信息
    const privileges = ref<any[]>([]);

    // 定义actions
    const changeUserInfo = (params: any) => {
        console.log('piniaAction:userInfo接收的参数=>', params);
        userInfo.value = params;
    };

    const changePrivileges = (params: any) => {
        console.log('piniaAction:privileges接收的参数=>', params);
        privileges.value = params;
    };

    return {
        userInfo,
        privileges,
        changeUserInfo,
        changePrivileges,
    };
});
